<template>
    <div>
        <h2>学生管理</h2>
        <Search @show="show"></Search>
        <Add @show="show"></Add>
        <Update @show="show" ></Update>
        <List :students="students" @show="show" ></List>
        <Pagination :pagination="pagination" @show="show"></Pagination>
    </div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import Search from "./Search.vue";
import List from "./List.vue";
import Add from "./Add.vue";
import Update from "./Update.vue";
import Pagination from "../../components/Pagination.vue";
import { listStudent } from "../../service/student";

const students = ref([]);
const pagination = ref({});
const searchParams = ref({});
async function show(current = 1, pageSize = 5,parmas) {
    if(parmas){
        searchParams.value = parmas;
    }
    let res = await listStudent(current, pageSize,searchParams.value);
    students.value = res.data.list;
    pagination.value = res.data;
    console.log(res);
}
function setVisible(updateVisible) {
    visible.value = updateVisible;
}
function setStudent(updateStudent) {
    student.value = updateStudent;
}
onMounted(() => {
    show();
});
</script>
<style></style>
